home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dbt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  10.5 KB  |  367 lines

  1. /*****************************************************************************
  2.  *
  3.  *  Copyright (c) 1993-1996 Microsoft Corporation
  4.  *
  5.  *  Title:      DBT.H - Equates for WM_DEVICECHANGE and BroadcastSystemMessage
  6.  *
  7.  *  Version:    4.00
  8.  *
  9.  *  Date:       24-May-1993
  10.  *
  11.  *  Author:     rjc
  12.  *
  13.  *----------------------------------------------------------------------------
  14.  *
  15.  *  Change log:
  16.  *
  17.  *     DATE     REV                 DESCRIPTION
  18.  *  ----------- --- ----------------------------------------------------------
  19.  *
  20.  *****************************************************************************/
  21.  
  22. #ifndef _DBT_H
  23. #define    _DBT_H
  24. #pragma option push -b
  25.  
  26. #ifdef __BORLANDC__
  27. #  include <pshpack8.h>
  28. #endif
  29.  
  30. /*
  31.  * BroadcastSpecialMessage constants.
  32.  */
  33. #define WM_DEVICECHANGE        0x0219
  34.  
  35. /* XLATOFF */
  36. #ifdef    IS_32
  37. #define    DBTFAR
  38. #else
  39. #define    DBTFAR    far
  40. #endif
  41. /* XLATON */
  42.  
  43. /*
  44.  * Broadcast message and receipient flags.
  45.  *
  46.  * Note that there is a third "flag". If the wParam has:
  47.  *
  48.  * bit 15 on:    lparam is a pointer and bit 14 is meaningfull.
  49.  * bit 15 off:    lparam is just a UNLONG data type.
  50.  *
  51.  * bit 14 on:    lparam is a pointer to an ASCIIZ string.
  52.  * bit 14 off:    lparam is a pointer to a binary struture starting with
  53.  *        a dword describing the length of the structure.
  54.  */
  55. #define BSF_QUERY        0x00000001
  56. #define BSF_IGNORECURRENTTASK    0x00000002    /* Meaningless for VxDs */
  57. #define BSF_FLUSHDISK        0x00000004    /* Shouldn't be used by VxDs */
  58. #define BSF_NOHANG              0x00000008
  59. #define BSF_POSTMESSAGE        0x00000010
  60. #define BSF_FORCEIFHUNG         0x00000020
  61. #define BSF_NOTIMEOUTIFNOTHUNG  0x00000040
  62. #define    BSF_MSGSRV32ISOK    0x80000000    /* Called synchronously from PM API */
  63. #define    BSF_MSGSRV32ISOK_BIT    31        /* Called synchronously from PM API */
  64.  
  65. #define BSM_ALLCOMPONENTS    0x00000000
  66. #define BSM_VXDS                0x00000001
  67. #define BSM_NETDRIVER           0x00000002
  68. #define BSM_INSTALLABLEDRIVERS  0x00000004
  69. #define BSM_APPLICATIONS        0x00000008
  70.  
  71. /*
  72.  * Message = WM_DEVICECHANGE
  73.  * wParam  = DBT_APPYBEGIN
  74.  * lParam  = (not used)
  75.  *
  76.  *    'Appy-time is now available.  This message is itself sent
  77.  *    at 'Appy-time.
  78.  *
  79.  * Message = WM_DEVICECHANGE
  80.  * wParam  = DBT_APPYEND
  81.  * lParam  = (not used)
  82.  *
  83.  *    'Appy-time is no longer available.  This message is *NOT* sent
  84.  *    at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
  85.  *
  86.  * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
  87.  * multiple times during a single Windows session.  Each appearance of
  88.  * 'Appy-time is bracketed by these two messages, but 'Appy-time may
  89.  * momentarily become unavailable during otherwise normal Windows
  90.  * processing.  The current status of 'Appy-time availability can always
  91.  * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
  92.  */
  93. #define DBT_APPYBEGIN            0x0000
  94. #define DBT_APPYEND            0x0001
  95.  
  96. /*
  97.  * Message = WM_DEVICECHANGE
  98.  * wParam  = DBT_DEVNODES_CHANGED
  99.  * lParam  = 0
  100.  *
  101.  *    send when configmg finished a process tree batch. Some devnodes
  102.  *    may have been added or removed. This is used by ring3 people which
  103.  *    need to be refreshed whenever any devnode changed occur (like
  104.  *    device manager). People specific to certain devices should use
  105.  *    DBT_DEVICE* instead.
  106.  */
  107.  
  108. #define DBT_DEVNODES_CHANGED            0x0007
  109.  
  110. /*
  111.  * Message = WM_DEVICECHANGE
  112.  * wParam  = DBT_QUERYCHANGECONFIG
  113.  * lParam  = 0
  114.  *
  115.  *      sent to ask if a config change is allowed
  116.  */
  117.  
  118. #define DBT_QUERYCHANGECONFIG           0x0017
  119.  
  120. /*
  121.  * Message = WM_DEVICECHANGE
  122.  * wParam  = DBT_CONFIGCHANGED
  123.  * lParam  = 0
  124.  *
  125.  *      sent when a config has changed
  126.  */
  127.  
  128. #define DBT_CONFIGCHANGED               0x0018
  129.  
  130. /*
  131.  * Message = WM_DEVICECHANGE
  132.  * wParam  = DBT_CONFIGCHANGECANCELED
  133.  * lParam  = 0
  134.  *
  135.  *      someone cancelled the config change
  136.  */
  137.  
  138. #define DBT_CONFIGCHANGECANCELED        0x0019
  139.  
  140. /*
  141.  * Message = WM_DEVICECHANGE
  142.  * wParam  = DBT_MONITORCHANGE
  143.  * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
  144.  *           if 0, use the default res for current config
  145.  *
  146.  *      this message is sent when the display monitor has changed
  147.  *      and the system should change the display mode to match it.
  148.  */
  149.  
  150. #define DBT_MONITORCHANGE               0x001B
  151.  
  152. /*
  153.  * Message = WM_DEVICECHANGE
  154.  * wParam  = DBT_SHELLLOGGEDON
  155.  * lParam  = 0
  156.  *
  157.  *    The shell has finished login on: VxD can now do Shell_EXEC.
  158.  */
  159.  
  160. #define    DBT_SHELLLOGGEDON        0x0020
  161.  
  162. /*
  163.  * Message = WM_DEVICECHANGE
  164.  * wParam  = DBT_CONFIGMGAPI
  165.  * lParam  = CONFIGMG API Packet
  166.  *
  167.  *    CONFIGMG ring 3 call.
  168.  */
  169. #define    DBT_CONFIGMGAPI32        0x0022
  170.  
  171. /*
  172.  * Message = WM_DEVICECHANGE
  173.  * wParam  = DBT_VOLLOCK*
  174.  * lParam  = pointer to VolLockBroadcast structure described below
  175.  *
  176.  *    Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
  177.  *    All these messages pass a pointer to a struct which has no pointers.
  178.  */
  179.  
  180. #define DBT_VOLLOCKQUERYLOCK    0x8041
  181. #define DBT_VOLLOCKLOCKTAKEN    0x8042
  182. #define DBT_VOLLOCKLOCKFAILED    0x8043
  183. #define DBT_VOLLOCKQUERYUNLOCK    0x8044
  184. #define DBT_VOLLOCKLOCKRELEASED    0x8045
  185. #define DBT_VOLLOCKUNLOCKFAILED    0x8046
  186.  
  187. /*
  188.  * Device broadcast header
  189.  */
  190.  
  191. struct _DEV_BROADCAST_HDR {    /* */
  192.     DWORD    dbch_size;
  193.     DWORD    dbch_devicetype;
  194.     DWORD       dbch_reserved;
  195. };
  196.  
  197. typedef struct     _DEV_BROADCAST_HDR    DEV_BROADCAST_HDR;
  198. typedef        DEV_BROADCAST_HDR    DBTFAR *PDEV_BROADCAST_HDR;
  199.  
  200. /*
  201.  * Structure for volume lock broadcast
  202.  */
  203.  
  204. typedef struct VolLockBroadcast VolLockBroadcast;
  205. typedef VolLockBroadcast *pVolLockBroadcast;
  206. struct VolLockBroadcast {
  207.     struct    _DEV_BROADCAST_HDR vlb_dbh;
  208.     DWORD    vlb_owner;        // thread on which lock request is being issued
  209.     BYTE    vlb_perms;        // lock permission flags defined below
  210.     BYTE    vlb_lockType;    // type of lock
  211.     BYTE    vlb_drive;        // drive on which lock is issued
  212.     BYTE    vlb_flags;        // miscellaneous flags
  213. };
  214.  
  215. /*
  216.  * Values for vlb_perms
  217.  */
  218. #define LOCKP_ALLOW_WRITES        0x01    // Bit 0 set - allow writes
  219. #define LOCKP_FAIL_WRITES        0x00    // Bit 0 clear - fail writes
  220. #define LOCKP_FAIL_MEM_MAPPING    0x02    // Bit 1 set - fail memory mappings
  221. #define LOCKP_ALLOW_MEM_MAPPING    0x00    // Bit 1 clear - allow memory mappings
  222. #define LOCKP_USER_MASK            0x03    // Mask for user lock flags
  223. #define LOCKP_LOCK_FOR_FORMAT    0x04    // Level 0 lock for format
  224.  
  225. /*
  226.  * Values for vlb_flags
  227.  */
  228. #define LOCKF_LOGICAL_LOCK        0x00    // Bit 0 clear - logical lock
  229. #define LOCKF_PHYSICAL_LOCK        0x01    // Bit 0 set - physical lock
  230.  
  231.  
  232. /*
  233.  * Message = WM_DEVICECHANGE
  234.  * wParam  = DBT_NODISKSPACE
  235.  * lParam  = drive number of drive that is out of disk space (1-based)
  236.  *
  237.  * Message issued by IFS manager when it detects that a drive is run out of
  238.  * free space.
  239.  */
  240.  
  241. #define DBT_NO_DISK_SPACE        0x0047
  242.  
  243.  
  244. #define DBT_CONFIGMGPRIVATE    0x7FFF
  245.  
  246. /*
  247.  * The following messages are for WM_DEVICECHANGE. The immediate list
  248.  * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
  249.  * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
  250.  *
  251.  */
  252. #define DBT_DEVICEARRIVAL        0x8000    // system detected a new device
  253. #define DBT_DEVICEQUERYREMOVE        0x8001    // wants to remove, may fail
  254. #define DBT_DEVICEQUERYREMOVEFAILED    0x8002  // removal aborted         
  255. #define DBT_DEVICEREMOVEPENDING        0x8003  // about to remove, still avail.
  256. #define DBT_DEVICEREMOVECOMPLETE    0x8004  // device is gone
  257. #define DBT_DEVICETYPESPECIFIC        0x8005  // type specific event
  258.  
  259. #define DBT_DEVTYP_OEM            0x00000000  // oem-defined device type
  260. #define DBT_DEVTYP_DEVNODE        0x00000001  // devnode number
  261. #define DBT_DEVTYP_VOLUME        0x00000002  // logical volume
  262. #define DBT_DEVTYP_PORT            0x00000003  // serial, parallel
  263. #define DBT_DEVTYP_NET            0x00000004  // network resource
  264.  
  265. struct _DEV_BROADCAST_HEADER { /* */
  266.     DWORD    dbcd_size;
  267.     DWORD    dbcd_devicetype;
  268.     DWORD       dbcd_reserved;
  269. };
  270.  
  271. struct _DEV_BROADCAST_OEM {    /* */
  272.     DWORD    dbco_size;
  273.     DWORD    dbco_devicetype;
  274.     DWORD       dbco_reserved;
  275.     DWORD    dbco_identifier;
  276.     DWORD    dbco_suppfunc;
  277. };
  278.  
  279. typedef struct     _DEV_BROADCAST_OEM    DEV_BROADCAST_OEM;
  280. typedef        DEV_BROADCAST_OEM    DBTFAR *PDEV_BROADCAST_OEM;
  281.  
  282. struct _DEV_BROADCAST_DEVNODE { /* */
  283.     DWORD    dbcd_size;
  284.     DWORD    dbcd_devicetype;
  285.     DWORD       dbcd_reserved;
  286.     DWORD    dbcd_devnode;
  287. };
  288.  
  289. typedef struct     _DEV_BROADCAST_DEVNODE    DEV_BROADCAST_DEVNODE;
  290. typedef        DEV_BROADCAST_DEVNODE    DBTFAR *PDEV_BROADCAST_DEVNODE;
  291.  
  292. struct _DEV_BROADCAST_VOLUME { /* */
  293.     DWORD    dbcv_size;
  294.     DWORD    dbcv_devicetype;
  295.     DWORD       dbcv_reserved;
  296.     DWORD    dbcv_unitmask;
  297.     WORD    dbcv_flags;
  298. };
  299.  
  300. typedef struct     _DEV_BROADCAST_VOLUME    DEV_BROADCAST_VOLUME;
  301. typedef        DEV_BROADCAST_VOLUME    DBTFAR *PDEV_BROADCAST_VOLUME;
  302.  
  303. #define DBTF_MEDIA    0x0001        // media comings and goings
  304. #define DBTF_NET    0x0002        // network volume
  305.  
  306. struct _DEV_BROADCAST_PORT { /* */
  307.     DWORD    dbcp_size;
  308.     DWORD    dbcp_devicetype;
  309.     DWORD       dbcp_reserved;
  310.     char    dbcp_name[1];
  311. };
  312.  
  313. typedef struct     _DEV_BROADCAST_PORT    DEV_BROADCAST_PORT;
  314. typedef        DEV_BROADCAST_PORT    DBTFAR *PDEV_BROADCAST_PORT;
  315.  
  316. struct _DEV_BROADCAST_NET { /* */
  317.     DWORD    dbcn_size;
  318.     DWORD    dbcn_devicetype;
  319.     DWORD       dbcn_reserved;
  320.     DWORD    dbcn_resource;
  321.     DWORD    dbcn_flags;
  322. };
  323.  
  324. typedef struct     _DEV_BROADCAST_NET    DEV_BROADCAST_NET;
  325. typedef        DEV_BROADCAST_NET    DBTFAR *PDEV_BROADCAST_NET;
  326.  
  327. #define DBTF_RESOURCE    0x00000001    // network resource
  328. #define DBTF_XPORT        0x00000002    // new transport coming or going
  329. #define DBTF_SLOWNET    0x00000004  // new incoming transport is slow
  330.                     // (dbcn_resource undefined for now)
  331.  
  332. #define    DBT_VPOWERDAPI    0x8100        // VPOWERD API for Win95
  333.  
  334. /*
  335.  *  User-defined message types all use wParam = 0xFFFF with the
  336.  *  lParam a pointer to the structure below.
  337.  *
  338.  *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
  339.  *
  340.  *  dbud_szName contains a case-sensitive ASCIIZ name which names the
  341.  *  message.  The message name consists of the vendor name, a backslash,
  342.  *  then arbitrary user-defined ASCIIZ text.  For example:
  343.  *
  344.  *    "WidgetWare\QueryScannerShutdown"
  345.  *    "WidgetWare\Video Q39S\AdapterReady"
  346.  *
  347.  *  After the ASCIIZ name, arbitrary information may be provided.
  348.  *  Make sure that dbud_dbh.dbch_size is big enough to encompass
  349.  *  all the data.  And remember that nothing in the structure may
  350.  *  contain pointers.
  351.  */
  352.  
  353. #define DBT_USERDEFINED    0xFFFF
  354.  
  355. struct _DEV_BROADCAST_USERDEFINED { /* */
  356.     struct _DEV_BROADCAST_HDR dbud_dbh;
  357.     char    dbud_szName[1];        /* ASCIIZ name */
  358. /*  BYTE    dbud_rgbUserDefined[];*/ /* User-defined contents */
  359. };
  360.  
  361. #ifdef __BORLANDC__
  362. #  include <poppack.h>
  363. #endif
  364.  
  365. #pragma option pop
  366. #endif    // _DBT_H
  367.